<?php
class activities extends Controller
{
	
	public function index ()
	{
	
		$this->session();
		$data['title'] = new BufferedView('members/tmembersActivities');
		$model = new member();
		$event = $model->getMyEvent($_SESSION['stud_no']); 
		$data['content'] = new BufferedView('members/activities',array(
			 'activities' => $event
		) );
        
		
		
		new View ("members/membersTemplate", $data);
	}

	public function show ($eventId)
	{
	
		$this->session();
//		$data['title'] = new BufferedView('members/tviewActivity');
		$model = new member();
		$eventbyId = $model->getMyEventById($_SESSION['stud_no'],$eventId); 
		$data['heading'] = 'Activity Details';
		$data['globalnav'] = new BufferedView('org/globalnav');
		$data['usernav'] = new BufferedView('members/usernav', array( 'highlight' => 'myactivities' ));
		$data['content'] = new BufferedView('members/view_activity',array(
			 'event' => $eventbyId[0]
		) );
        
		
		new View ("template", $data);
	}

	public function cancel()
	{
		$this->session();
		$model = new registration();
		$cancelReg = $model->deleteReg($_POST['regId'] ); 
		$message = 'Your registration has been cancelled.
		Click <a href="/my/activities">here</a> to go back.' ;
		new View('template', array( 
			'content' => $message,
			'globalnav' => new BufferedView('org/globalnav'),
			'usernav' => new BufferedView('members/usernav', array( 'highlight' => 'myactivities' )),
		));
	}


}

